package com.travel.controller.admin;

import com.travel.model.dto.common.ApiResponse;
import com.travel.service.Service.ApiStatisticsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;
//API统计接口 , 获取API调用统计信息
@Tag(name = "API统计", description = "API调用统计相关接口")
@RestController
@RequestMapping("/api/admin/statistics")
@RequiredArgsConstructor
public class ApiStatisticsController {

    private final ApiStatisticsService apiStatisticsService;

    @Operation(summary = "获取API统计信息")
    @GetMapping
    public ApiResponse<List<Map<String, Object>>> getApiStatistics() {
        List<Map<String, Object>> statistics = apiStatisticsService.getApiStatistics();
        return ApiResponse.success("获取API统计信息成功", statistics);
    }
} 